home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- FILE *in_fp;
- FILE *out_fp;
- int a;
- int char_count = 0;
-
- if ((in_fp = fopen(argv[1],"r")) == NULL) {
- printf("cannot open file %s\n", argv[1]);
- exit(1);
- }
- if ((out_fp = fopen(argv[2],"w")) == NULL) {
- printf("cannot open file %s\n", argv[2]);
- exit(1);
- }
- while ((a = fgetc(in_fp)) != EOF) {
- fprintf(out_fp, "%02X", a);
- if (++char_count >= 40) {
- fputc('\n', out_fp);
- char_count = 0;
- }
- }
- fputc('\n', out_fp);
- fclose(in_fp);
- fclose(out_fp);
- }
-